Function: $A(domElementOrMarkupStringOrCSSSelector) Description: Create and return a $A Chain Object. Returns: $A Chain Object. Note: All Chain objects map to the $A (4X) API, and can be chained together to create complex chaining statements. If the argument passed to $A() is bound as the ID of a DC object however, the DC object will be returned instead. When a DC object is returned, it then maps to the DC API. When chained, string markup will automatically be converted into a DOM node fragment, or CSS selectores will query the targetted elements to reference those that match. Example: // Create a chain object using a DOM element. var myChain = $A(domElement); // Create a chain object using a CSS selector to locate the first div with the class "errorSection", and move focus to it. var myChain = $A("div.errorSection").focus(); // Create a DOM fragment ready for chaining with additional methods. var myChain = $A('') // Then set attributes on the new object stored within the chain. .setAttribute({ "aria-pressed": "false" }) // Then bind events to the object within the chain. .on({ click: function(e) { $A(this).toggleClass("pressed", function(stateIsTrue) { // Change associated attribute to match the toggle class state from within the callback. $A(this).setAttribute("aria-pressed", stateIsTrue ? "true" : "false"); }); } }) // Then insert the new object as modified before the first H1 element on the page using a CSS selector. .before("h1"); // Return the modified object within a chain. var domElement = myChain.return();